package org.base.dao.config;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.baomidou.mybatisplus.entity.GlobalConfiguration;
import com.baomidou.mybatisplus.plugins.PaginationInterceptor;

@Configuration
public class MybatisPlusConfig {

	private static final Logger log = LoggerFactory.getLogger(MybatisPlusConfig.class);

    /**
	 * mybatisPlus全局配置
	 */
	@Bean
	@ConfigurationProperties(prefix="mybatis-plus.global-config")
	public GlobalConfiguration globalConfig() {
		log.info("init GlobalConfiguration .......");
		GlobalConfiguration globalConfig = new GlobalConfiguration();
		// 数据库大写下划线转换
		globalConfig.setCapitalMode(true);
		return globalConfig;
	}
	
	/**
     * 分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        return paginationInterceptor;
    }

}
